package com.sky.mapper;

import com.sky.entity.User;
import io.swagger.v3.oas.annotations.Operation;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

public interface LoginMapper {

    @Select("select * from user where openid = #{openId}")
    User selectByOpenId(String openId);

//    主键返回
    @Options(useGeneratedKeys = true,keyProperty = "id")
    @Insert("insert into user(openid, name, create_time) values(#{openid},#{name},#{createTime})")
    void addByOpenId(User user);

    @Select("select * from user where id = #{userId}")
    User selectById(Long userId);

    Integer userStatistics(Map map);
}
